﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="OptimumInfra.Models" %>
<%@ Import Namespace="System.Collections.Generic" %>
<asp:Content ID="Content2" ContentPlaceHolderID="AdminContent" runat="server">

    <% if(TempData["info"] !=null) { %>
    <p style="text-align: center; color: Red;"><%=TempData["info"] %></p>
    <% } %>
  <table width="700px" style="margin-top: 10px;">
  <tr>
     <th>--</th>  
     <th>Id</th>
     <th>Customer</th>
      <th>Date Created</th>
     <th>Delete</th>
    
  </tr>
    <%
    
        foreach (var email in (ViewData["emails"] as IEnumerable<Newsletter>))
        {
            %>           
               <tr>
                <td width="30px"><input type="checkbox" name="ids" id="ids<%=email.Id %>" value="<%=email.Id %>" onclick="isChecked(this.checked);" /></td>
                <td width="30px"><%=email.Id%></td>
                <td>
                 <%=Html.ActionLink(email.Email, "Edit", new { id = email.Id })%>
                 </td
                  <td>
                      <%=email.DateAdd %>
                 </td
                <td width="50px"><%=Html.ActionLink("Delete", "Delete", new { id = email.Id })%></td>
               </tr> 
            <%
        }
            
         %>
     </table>
     <input type="hidden" name="ids" />
     <input type="hidden" name="boxchecked" value="0" />
     <input type="submit" value="Delete" />
     
<script type="text/javascript">
    function isChecked(isitchecked) {
        if (isitchecked == true) {
            document.productPin.boxchecked.value++;
        }
        else {
            document.productPin.boxchecked.value--;
        }
    }
    function validate() {

        var form = document.productPin;
        var names = form.cid;
        var ids = "";
        for (var i = 0; i < names.length; i++) {
            if (names[i].checked) {
                ids += names[i].value + ",";

            }
        }
        form.ids.value = ids;
        form.submit();
    }
 </script>
</asp:Content>
